-
Notifications
You must be signed in to change notification settings - Fork 747
fix(amazonq): Fix showSsoPrompt unit tests #7236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(amazonq): Fix showSsoPrompt unit tests #7236
Conversation
|
| assert.strictEqual(loginStub.called, true) | ||
| assert.strictEqual(loginStub.firstCall.args[0], constants.builderIdStartUrl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't we test the logged messages now ? can an equivalent log message be added in the relevant place in the new module ? that allows testing the real codepath (or something closer to it), instead of stubs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getTestLogger().getLoggedEntries() call was failing to pick up the logger. The issue with only testing a log line is that the test won't fail if the functionality is removed or changes (the login call with AWS ID is what we care about asserting here, not a logged string). I did not spend time to dive deeper into it because it's a secondary assertion IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with only testing a log line is that the test won't fail if the functionality is removed or changes (the login call with AWS ID is what we care about asserting here, not a logged string)
Sure, but that applies to any kind of telemetry (aka logs): the telemetry is wrong if logic changes without updating the telemetry. And a similar situation applies when stubs/mocks are used: asserting that a method was called doesn't actually test that the functionality works, and can easily drift (also, asserting stubs leads to brittle tests).
4b0ec4d
into
aws:feature/amazonqLSP-auth
Problem
showConnectionPromptunit tests were failingSolution
feature/xbranches will not be squash-merged at release time.